package ch07.home;

class Exercise7_01 {
	public static void main(String args[]) {
		SutdaDeck01 deck = new SutdaDeck01();

		for (int i = 0; i < deck.cards.length; i++)
			System.out.print(deck.cards[i] + " ");
		// 1K 2 3K 4 5 6 7 8K 9 10 1 2 3 4 5 6 7 8 9 10 
	}
}

class SutdaDeck01 {
	final int CARD_NUM = 20;
	SutdaCard[] cards = new SutdaCard[CARD_NUM];

	SutdaDeck01() {
		// <1
		for (int i = 0; i < cards.length; i++) {
			int num = i % 10 + 1;
			boolean isKwang = (i < 10) && (num == 1 || num == 3 || num == 8);
			cards[i] = new SutdaCard(num, isKwang);
		}
		// 1>
	}
}

class SutdaCard {
	int num;
	boolean isKwang;

	SutdaCard() {
		this(1, true);
	}

	SutdaCard(int num, boolean isKwang) {
		this.num = num;
		this.isKwang = isKwang;
	}

	public String toString() {
		return num + (isKwang ? "K" : "");
	}
}
